package Practice;

import java.util.Scanner;

public class MentalArithmetic {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int i = sc.nextInt();
        sc.nextLine();
        char last = ' ';

        for (int j = 0; j < i; j++) {
            String line = sc.nextLine();
            String[] part = line.split(" ");
            int result = 0;
            char x = ' ';
            int num1 = 0,num2 = 0;

            if (part.length == 3){
                x = part[0].charAt(0);
                num1 = Integer.parseInt(part[1]);
                num2 = Integer.parseInt(part[2]);
                last = x;
            }
            else if (part.length == 2){
                num1 = Integer.parseInt(part[0]);
                num2 = Integer.parseInt(part[1]);
                x = last;
            }

            switch (x){
                case 'a':
                    result = num1 + num2;
                    x = '+';
                    break;
                case 'b':
                    result = num1 - num2;
                    x = '-';
                    break;
                case 'c':
                    result = num1 * num2;
                    x = '*';
                    break;
            }

            String s = num1 + String.valueOf(x) + num2 + '=' + result;
            int len = s.length();
            System.out.println(s);
            System.out.println(len);
        }
    }
}
